package com.demo.designpattern.proxy;

/**
 * Created by hunter
 *
 * @Description 代理模式
 */
public class MainTest {

    public static void main(String[] args) {

        Player normalPlayer = new NormalPlayer();

        // ~-------- 静态代理 begin
        Player levelingPlayer = new LevelingPlayer(normalPlayer);
        levelingPlayer.killMonster();
        levelingPlayer.upGrade();
        // ~-------- 静态代理 end

        System.out.println("~----------- 华丽的分割线");

        // ~-------- 静态代理 begin
        Player dynamicLevelingPlayer = (Player) new MyInvocationHandler(normalPlayer).getProxy();
        dynamicLevelingPlayer.killMonster();
        dynamicLevelingPlayer.upGrade();
        // ~-------- 静态代理 end
    }
}
